<?php include $this->admin_tpl('meta');?>
<title>模型管理 - YzmCMS内容管理系统</title>
</head>
<body>
<nav class="breadcrumb"><i class="yzm-iconfont yzm-iconai-home"></i> 首页 <span class="c-gray en">&gt;</span> 内容管理 <span class="c-gray en">&gt;</span> 模型管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="yzm-iconfont yzm-iconshuaxin"></i></a></nav>
<div class="page-container">
	<div class="cl tb-top"> <span class="l">
		<a href="javascript:;" onclick="yzm_open('添加模型','<?php echo U('add');?>','650','485')" class="btn btn-primary radius"><i class="yzm-iconfont yzm-icontianjia"></i> 添加模型</a>
		<a onclick="yzm_open('导入模型','<?php echo U('import');?>','550','300')" href="javascript:;" class="btn btn-warning radius"><i class="yzm-iconfont yzm-icondaochu"></i> 导入模型</a>  
	</span></div>
	<table class="table table-border table-bg table-hover">
		<thead>
			<tr class="text-c">
				<th>模型ID</th>
				<th>模型名称</th>
				<th>模型表名</th>
				<th>模型别名</th>
				<th>描述</th>		
				<th>默认模型</th>
				<th>系统模型</th>
				<th>启用</th>
				<th>管理操作</th>
			</tr>
		</thead>
		<tbody>
			<?php 
			   foreach($data as $val){
			 ?>
			<tr class="text-c">
				<td><?php echo $val['modelid'];?></td>
				<td><?php echo $val['name'];?></td>
				<td><?php echo $val['tablename'];?></td>
				<td><?php echo $val['alias'];?></td>
				<td><?php echo $val['description'] ? $val['description'] : '无';?></td>
				<td><?php echo $val['isdefault'] ? '<span class="c-red">是</span>' : '否';?></td>
				<td><?php echo $val['issystem'] ? '<span class="c-green">是</span>' : '否';?></td>
				<td>
					<?php if(!$val['disabled']){ ?>
					<span class="yzm-status-enable" data-field="disabled" data-id="<?php echo $val['modelid']?>" onclick="yzm_change_status(this,'<?php echo U('public_change_status');?>')"><i class="yzm-iconfont">&#xe81f;</i>是</span>
					<?php }else{ ?>
					<span class="yzm-status-disable" data-field="disabled" data-id="<?php echo $val['modelid']?>" onclick="yzm_change_status(this,'<?php echo U('public_change_status');?>')"><i class="yzm-iconfont">&#xe601;</i>否</span>
					<?php } ?>
				</td>
				<td class="td-manage">
					<a title="字段管理"  class="btn-mini btn-primary ml-5" href="<?php echo U('model_field/init',array('modelid'=>$val['modelid']));?>" style="text-decoration:none">字段管理</a> 
					<a title="编辑"  class="btn-mini btn-success ml-5" href="javascript:;" onclick="yzm_open('编辑模型','<?php echo U('edit',array('modelid'=>$val['modelid']));?>','650','485')" style="text-decoration:none">编辑</a> 
					<a title="删除" href="javascript:;" onclick="yzm_confirm('<?php echo U('delete',array('modelid'=>$val['modelid']));?>', '确定要删除【<?php echo $val['name'];?>】模型吗？<br><span style=\'color:#ee3b3b\'><span class=\'yzm-iconfont yzm-iconshuoming\'></span> 删除模型将删除该模型下的所有数据！</span>',1,0)"  class="btn-mini btn-danger ml-5" style="text-decoration:none">删除</a>
					<a title="导出" href="<?php echo U('export',array('modelid'=>$val['modelid']));?>"  class="btn-mini btn-secondary ml-5" style="text-decoration:none">导出</a>
				</td>
			</tr>
			<?php 
			   }		 
			?>	
		</tbody>
	</table>
	<?php if(!$data){ ?><div class="yzm_no_data"><i class="yzm-iconfont yzm-iconshuoming"></i> 暂无数据</div><?php } ?>
</div>
<?php include $this->admin_tpl('footer');?>
</body>
</html>